| API Documentation |  |

- MAIN PAGE
- NAMESPACES
- CLASSES

BufferView.h
1 // BufferView.h
3 //
5
6 namespace nkMemory
7 {
16 template <typename T = unsigned char>
17 class BufferView
18 {
19 public :
20
21 // Constructors, destructor
25 BufferView () noexcept ;
33 BufferView (T* data, unsigned long long size) noexcept ;
40 BufferView (const Buffer& buffer) noexcept ;
49 BufferView (const Buffer& buffer, unsigned long long index, unsigned long long length = 0) noexcept ;
56 BufferView (Buffer&& buffer) = delete ;
57
58 public :
59
60 // Getters
64 T* getData () const ;
68 unsigned long long getSize () const ;
72 bool empty () const ;
76 T& front () ;
80 const T& front () const ;
84 T& back () ;
88 const T& back () const ;
92 T* begin () ;
96 const T* begin () const ;
100 T* end () ;
104 const T* end () const ;
105
106 public :
107
108 // Conversions
116 BufferView<T> subView (unsigned long long index, unsigned long long length = 0) const ;
117
118 public :
119
120 // Operators
127 T& operator[] (unsigned long long index) ;
134 const T& operator[] (unsigned long long index) const ;
140 BufferView<T>& operator= (const BufferView<T>& other) noexcept ;
146 BufferView<T>& operator= (BufferView<T>&& other) noexcept ;
147
148 public :
149
150 // Constructors templated
156 template <typename U>
157 BufferView (const BufferCast<U>& bufferCast) noexcept ;
163 BufferView (const BufferCast<T>& bufferCast) noexcept ;
169 template <typename U>
170 BufferView (const BufferView<U>& view) noexcept ;
176 BufferView (const BufferView<T>& view) noexcept ;
182 BufferView (BufferView<T>&& other) noexcept ;
188 template <typename U, std::size_t S>
189 BufferView (std::array<U, S>& array) noexcept ;
195 template <std::size_t S>
196 BufferView (std::array<T, S>& array) noexcept ;
202 template <typename U>
203 BufferView (std::vector<U>& vec) noexcept ;
209 BufferView (std::vector<T>& vec) noexcept ;
210
218 template <typename U, std::size_t S, typename = std::enable_if<std::is_const<T>::value>>
219 BufferView (const std::array<U, S>& array) noexcept ;
227 template <std::size_t S, typename = std::enable_if<std::is_const<T>::value>>
228 BufferView (const std::array<typename std::remove_const<T>::type, S>& array) noexcept ;
236 template <typename U, typename = std::enable_if<std::is_const<T>::value>>
237 BufferView (const std::vector<U>& vec) noexcept ;
245 template <typename = std::enable_if<std::is_const<T>::value>>
246 BufferView (const std::vector<typename std::remove_const<T>::type>& vec) noexcept ;
247
248 public :
249
250 // Conversion operators
255 operator Buffer () const ;
256
261 template <typename U = T>
262 operator BufferCast<U> () const ;
263 } ;
264 }
nkMemory::BufferView::end
T * end()
nkMemory::BufferView
A view over data.
Definition: BufferView.h:18
nkMemory::BufferView::begin
T * begin()
nkMemory::BufferView::getData
T * getData() const
nkMemory::BufferView::back
T & back()
nkMemory::BufferView::getSize
unsigned long long getSize() const
nkMemory::Buffer
A buffer holding binary data.
Definition: Buffer.h:32
nkMemory::BufferView::BufferView
BufferView() noexcept
nkMemory::BufferCast
Holds a Buffer and make it easy to cast the binary data.
Definition: BufferCast.h:18
nkMemory::BufferView::empty
bool empty() const
nkMemory::BufferView::front
T & front()
nkMemory::BufferView::subView
BufferView< T > subView(unsigned long long index, unsigned long long length=0) const
nkMemory
Encompasses all API of component NilkinsMemory.
Definition: Allocator.h:7